package com.yc.bos.web.interceptor;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;
import com.yc.bos.model.User;
import org.apache.struts2.ServletActionContext;

public class BOSLoginInterceptor extends MethodFilterInterceptor {
    @Override
    protected String doIntercept(ActionInvocation actionInvocation) throws Exception {
        User user= (User) ServletActionContext.getRequest().getSession().getAttribute("loginUser");
        System.out.println("拦截了.."+ServletActionContext.getRequest().getRequestURI());
        if(user!=null){
            return  actionInvocation.invoke();
        }
        return "login";
    }
}
